package com.dems.web;


import com.dems.dao.MpDao;
import com.dems.domain.Mp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/RegistMpServlet")
public class RegistMpServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private MpDao mpDao = new MpDao();
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RegistMpServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取参数
        String mpNum = request.getParameter("mpNum");
        String mpPassword = request.getParameter("mpPassword");
        String buildingId = request.getParameter("buildingId");
        String mpType = request.getParameter("mpType");
        Mp mp = new Mp();
        mp.setMpNum(mpNum);
        mp.setMpPassword(mpPassword);
        mp.setBuildingId(buildingId);
        mp.setMpType(mpType);
        mpDao.regist(mp);
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}

